package com.freelance.vn.apps.puzzle.activity;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import android.app.Application;

public class PuzzleGameApplication extends Application{
	public static ExecutorService mExecutorService;
	public final static int MAX_THREAD_RUNNING=5;
	public static void startApp(){
		if (mExecutorService == null) {
            mExecutorService = Executors.newFixedThreadPool(MAX_THREAD_RUNNING);
        }
	}
	public static void executeRunnable(Runnable task) {
	        if (mExecutorService == null) {
	            return;
	        }
	        mExecutorService.submit(task);
	}
	 public static void finishApp() {
	        if(mExecutorService != null) {
	            mExecutorService.shutdown();
	            mExecutorService = null;
	        }
	    }
}
